Skip to content

Commit 78ecd49

Browse files
authored
Merge pull request #58 from pnnl/develop
Develop
2 parents f83e2f6 + 9efc5f0 commit 78ecd49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5495
-400
lines changed

AGENTS.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ See `examples/sim_chat_stream_demo/chatbot.py` for a concrete example that wires
117117
- **Add a new skill**: drop a `.md` or `.txt` file under an allowed root and register it in `skills_config` (or add a directory registry entry).【F:automa_ai/skills/README.md†L10-L35】
118118
- **Add a new memory store**: implement `BaseMemoryStore`, register with `MemoryStoreRegistry`, then update the `memory_config` for `DefaultMemoryManager`.【F:automa_ai/memory/memory_stores.py†L1-L59】【F:automa_ai/memory/manager.py†L46-L82】
119119

120+
121+
## Default tools (non-MCP)
122+
123+
BEM-AI now supports first-class default tools configured directly in `AgentFactory` via `tools_config` (not MCP).
124+
125+
- Core configuration models are in `automa_ai/config/tools.py` (`ToolsConfig`, `ToolSpec`).
126+
- Registry/factory and internal tool interface are in `automa_ai/tools/base.py` and `automa_ai/tools/registry.py`.
127+
- Built-in tools are registered in `automa_ai/tools/__init__.py`.
128+
- `AgentFactory` accepts `tools_config` and passes tool specs to `GenericLangGraphChatAgent`, which binds tools only when configured.
129+
- Built-in `web_search` implementation is under `automa_ai/tools/web_search/` with Serper/OSS search, Firecrawl/OSS scraping, and Jina/Cohere/OSS reranking.
130+
120131
## Building and Testing
121132

122133
The repository does not include a dedicated build step in this document, but you can run focused tests for the key subsystems below.
@@ -138,6 +149,62 @@ All pull request comments should be complete sentences and end with a period.
138149
- Add new tests for any new feature or bug fix.
139150
- Update documentation for user-facing changes.
140151

152+
## Example Development Guidelines (Lessons Learned)
153+
154+
Use this checklist for all new examples drafted in this repository.
155+
156+
### Required files and structure
157+
158+
- Every example must include:
159+
- a **Streamlit UI** script (`ui.py`), and
160+
- a server bootstrap script:
161+
- `agent.py` for a single-agent example, or
162+
- `multi_agents.py` for a multi-agent example.
163+
- Every example must include a `README.md` with:
164+
- what the example demonstrates,
165+
- setup instructions,
166+
- run instructions,
167+
- troubleshooting tips.
168+
- Add a local `.env` file in the example folder for API keys, model names, and service URLs.
169+
170+
### Agent construction and configuration
171+
172+
- Always create agents via `AgentFactory`.
173+
- Keep prompts as simple as possible.
174+
- MCP configs and system prompts should be defined in the server bootstrap script (`agent.py` or `multi_agents.py`) so startup behavior is explicit.
175+
176+
### Tools and memory plugin pattern
177+
178+
- Follow a registry + config pattern (similar to memory stores):
179+
- register implementations once via plugin/entry-point loading,
180+
- bind them with declarative config (`tools_config`, `memory_config`) in `AgentFactory`.
181+
- Avoid ad-hoc runtime registration functions in example flow logic.
182+
- For custom tools, prefer entry-point/plugin registration so multiprocess server workers can resolve the same tool types reliably.
183+
184+
### Multi-agent and streaming lessons
185+
186+
- For multi-agent demos:
187+
- use A2A subagent delegation (`SubAgentSpec`) instead of direct Python calls,
188+
- keep names/tool names deterministic and unique.
189+
- For Streamlit streaming UIs:
190+
- persist partial assistant output in `st.session_state`,
191+
- guard against rerun interruptions (disable refresh/session-reset controls while streaming),
192+
- only refresh side snapshots when no stream is active.
193+
194+
### Blackboard lessons
195+
196+
- If using local JSON blackboard backend, follow the backend file naming contract (`<session_id>.blackboard.json`).
197+
- Use blackboard operations and paths exactly as supported by tooling/contracts; avoid JSON-patch style ops if not supported.
198+
- Prefer context-aware `session_id` handling where available to reduce brittle LLM-generated IDs.
199+
200+
### Documentation expectations for engineering users
201+
202+
- Write README instructions for users who are domain engineers (for example, mechanical engineers) with moderate scripting experience.
203+
- Use practical examples and plain language:
204+
- expected inputs,
205+
- expected outputs,
206+
- how to validate success.
207+
141208
## Learning Mode
142209
When a user explicitly expressed that they are currently onboarding or learning this repository, the agent shall follow the additional instructions in the learning mode.
143210

@@ -157,3 +224,4 @@ When a user explicitly expressed that they are currently onboarding or learning
157224
- If the user asks for something complex, **suggest simpler alternatives**
158225
- Treat every session as a **teaching opportunity**
159226
- Be direct, **Tell the user when they are doing something wrong**
227+
-

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@ Project configuration is managed through `pyproject.toml`. Key configuration are
103103
- **Project Metadata**: Version, description, and author information
104104
- **Optional**: optional packages to use for UI integration and running examples.
105105

106+
### Default tools configuration
107+
108+
You can enable built-in tools directly from config using a `tools` list.
109+
110+
```yaml
111+
tools:
112+
- type: web_search
113+
config:
114+
provider: auto
115+
serper:
116+
api_key: ${SERPER_API_KEY}
117+
firecrawl:
118+
api_key: ${FIRECRAWL_API_KEY}
119+
scrape:
120+
enabled: true
121+
max_pages: 5
122+
rerank:
123+
provider: opensource
124+
top_k: 5
125+
```
126+
127+
Then pass this to `AgentFactory(..., tools_config=tools)` for `LANGGRAPHCHAT` agents.
128+
See `docs/tools.md` and `examples/web_search_demo.py` for a runnable example.
129+
106130
### A2A Server Base Path
107131

108132
You can mount an A2A agent server under a URL prefix by passing `base_url_path` to

0 commit comments

Comments
 (0)