{"id":36702257,"url":"https://github.com/embabel/java-agent-template","last_synced_at":"2026-01-12T11:39:20.988Z","repository":{"id":298075123,"uuid":"998742029","full_name":"embabel/java-agent-template","owner":"embabel","description":"Java agent template","archived":false,"fork":false,"pushed_at":"2025-12-24T06:16:19.000Z","size":247,"stargazers_count":109,"open_issues_count":7,"forks_count":36,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-12-25T01:04:15.079Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/embabel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-09T07:13:32.000Z","updated_at":"2025-12-24T06:16:23.000Z","dependencies_parsed_at":"2025-07-27T00:19:25.761Z","dependency_job_id":"0cc98233-9d13-4ff0-902a-957ecffeca1d","html_url":"https://github.com/embabel/java-agent-template","commit_stats":null,"previous_names":["embabel/java-agent-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/embabel/java-agent-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embabel%2Fjava-agent-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embabel%2Fjava-agent-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embabel%2Fjava-agent-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embabel%2Fjava-agent-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/embabel","download_url":"https://codeload.github.com/embabel/java-agent-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embabel%2Fjava-agent-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-12T11:39:20.384Z","updated_at":"2026-01-12T11:39:20.982Z","avatar_url":"https://github.com/embabel.png","language":"Java","funding_links":[],"categories":["Templates"],"sub_categories":[],"readme":"\u003cimg align=\"left\" src=\"https://github.com/embabel/embabel-agent/blob/main/embabel-agent-api/images/315px-Meister_der_Weltenchronik_001.jpg?raw=true\" width=\"180\"\u003e\n\n# Generated Agent Project\n\n![Build](https://github.com/embabel/java-agent-template/actions/workflows/maven.yml/badge.svg)\n\n![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge\u0026logo=openjdk\u0026logoColor=white) ![Spring](https://img.shields.io/badge/spring-%236DB33F.svg?style=for-the-badge\u0026logo=spring\u0026logoColor=white) ![Apache Maven](https://img.shields.io/badge/Apache%20Maven-C71A36?style=for-the-badge\u0026logo=Apache%20Maven\u0026logoColor=white) ![ChatGPT](https://img.shields.io/badge/chatGPT-74aa9c?style=for-the-badge\u0026logo=openai\u0026logoColor=white)\n\n\u003cbr clear=\"left\"/\u003e\n\nStarting point for your own agent development using the [Embabel framework](https://github.com/embabel/embabel-agent).\n\nUses Spring Boot 3.5.9 and Embabel 0.3.1.\n\nAdd your magic here!\n\nIllustrates:\n\n- An injected demo showing how any Spring component can be injected with an Embabel `Ai` instance to enable it to\n  perform LLM operations.\n- A simple agent\n- Unit tests for an agent verifying prompts and hyperparameters\n\n\u003e For the Kotlin equivalent, see\n\u003e our [Kotlin agent template](https://github.com/embabel/kotlin-agent-template).\n\n# Running\n\nRun the shell script to start Embabel under Spring Shell:\n\n```bash\n./scripts/shell.sh\n```\n\nThere is a single example\nagent, [WriteAndReviewAgent](./src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java).\nIt uses one LLM with a high temperature and creative persona to write a story based on your input,\nthen another LLM with a low temperature and different persona to review the story.\n\nWhen the Embabel shell comes up, invoke the story agent like this:\n\n```\nx \"Tell me a story about...[your topic]\"\n```\n\nTry the following other shell commands:\n\n- `demo`: Runs the same agent, invoked programmatically, instead of dynamically based on user input.\n  See [DemoCommands.java](./src/main/java/com/embabel/template/DemoShell.java) for the\n  implementation.\n- `animal`:  Runs a simple demo using an Embabel injected `Ai` instance to call an LLM.\n  See [InjectedDemo](./src/main/java/com/embabel/template/injected/InjectedDemo.java).\n\n## Suggested Next Steps\n\nTo get a feel for working with Embabel, try the following:\n\n- Modify the prompts in `WriteAndReviewAgent` and `InjectedDemo`.\n- Experiment with different models and hyperparameters by modifying `withLlm` calls.\n- Integrate your own services, injecting them with Spring. All Embabel `@Agent` classes are Spring beans.\n- Run the tests with `mvn test` and modify them to experiment with prompt verification.\n\nTo see tool support, check out the more\ncomplex [Embabel Agent API Examples](https://github.com/embabel/embabel-agent-examples) repository.\n\n## Model support\n\nEmbabel integrates with any LLM supported by Spring AI.\n\nSee [LLM integration guide](docs/llm-docs.md) (work in progress).\n\nAlso see [Spring AI models](https://docs.spring.io/spring-ai/reference/api/index.html).\n\n## Testing\n\nThis repository includes unit tests and integration tests demonstrating how to test Embabel agents.\n\n### Running Tests\n\n```bash\nmvn test\n```\n\n### Unit Tests\n\nUnit tests use Embabel's `FakeOperationContext` and `FakePromptRunner` to test agent actions in isolation without\ncalling actual LLMs.\n\nSee [WriteAndReviewAgentTest.java](./src/test/java/com/embabel/template/agent/WriteAndReviewAgentTest.java) for examples\nof:\n\n- Creating a fake context with `FakeOperationContext.create()`\n- Setting up expected responses with `context.expectResponse()`\n- Verifying prompt content contains expected values\n- Inspecting LLM invocations via `promptRunner.getLlmInvocations()`\n\n```java\nvar context = FakeOperationContext.create();\ncontext.expectResponse(new Story(\"Once upon a time...\"));\n\nvar story = agent.craftStory(userInput, context.ai());\n\nvar prompt = context.getLlmInvocations().getFirst().getMessages().getFirst().getContent();\nassertTrue(prompt.contains(\"knight\"));\n```\n\n### Integration Tests\n\nIntegration tests extend `EmbabelMockitoIntegrationTest` to test complete agent workflows under Spring Boot with a fully\nconfigured `AgentPlatform`.\n\nSee [WriteAndReviewAgentIntegrationTest.java](./src/test/java/com/embabel/template/agent/WriteAndReviewAgentIntegrationTest.java)\nfor examples of:\n\n- Mocking LLM responses with `whenCreateObject()` and `whenGenerateText()`\n- Running complete agent workflows via `AgentInvocation`\n- Verifying LLM calls and hyperparameters with `verifyCreateObjectMatching()` and `verifyGenerateTextMatching()`\n\n```java\nwhenCreateObject(prompt -\u003e prompt.contains(\"Craft a short story\"), Story.class)\n    .thenReturn(new Story(\"AI will transform our world...\"));\n\nvar invocation = AgentInvocation.create(agentPlatform, ReviewedStory.class);\nvar result = invocation.invoke(input);\n\nverifyCreateObjectMatching(\n    prompt -\u003e prompt.contains(\"Craft a short story\"),\n    Story.class,\n    llm -\u003e llm.getLlm().getTemperature() == 0.7\n);\n```\n\n## Contributors\n\n[![Embabel contributors](https://contrib.rocks/image?repo=embabel/java-agent-template)](https://github.com/embabel/java-agent-template/graphs/contributors)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembabel%2Fjava-agent-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembabel%2Fjava-agent-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembabel%2Fjava-agent-template/lists"}