Skip to content

Commit ed16d6a

Browse files
committed
chore: update API docs from spoon-ai-sdk
1 parent 8d85b8f commit ed16d6a

27 files changed

+1556
-586
lines changed

docs/api-reference/index.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,7 @@ Generated from spoon_ai sources. Each module below has its own page.
8282
- [spoon_ai.prompts](./spoon_ai/prompts/)
8383
- [spoon_ai.prompts.spoon_react](./spoon_ai/prompts/spoon_react.md)
8484
- [spoon_ai.prompts.toolcall](./spoon_ai/prompts/toolcall.md)
85-
- [spoon_ai.rag](./spoon_ai/rag/)
86-
- [spoon_ai.rag.config](./spoon_ai/rag/config.md)
87-
- [spoon_ai.rag.embeddings](./spoon_ai/rag/embeddings.md)
88-
- [spoon_ai.rag.index](./spoon_ai/rag/index.md)
89-
- [spoon_ai.rag.loader](./spoon_ai/rag/loader.md)
90-
- [spoon_ai.rag.qa](./spoon_ai/rag/qa.md)
91-
- [spoon_ai.rag.retriever](./spoon_ai/rag/retriever.md)
92-
- [spoon_ai.rag.vectorstores](./spoon_ai/rag/vectorstores/)
93-
- [spoon_ai.rag.vectorstores.base](./spoon_ai/rag/vectorstores/base.md)
94-
- [spoon_ai.rag.vectorstores.chroma_store](./spoon_ai/rag/vectorstores/chroma_store.md)
95-
- [spoon_ai.rag.vectorstores.faiss_store](./spoon_ai/rag/vectorstores/faiss_store.md)
96-
- [spoon_ai.rag.vectorstores.pinecone_store](./spoon_ai/rag/vectorstores/pinecone_store.md)
97-
- [spoon_ai.rag.vectorstores.qdrant_store](./spoon_ai/rag/vectorstores/qdrant_store.md)
98-
- [spoon_ai.rag.vectorstores.registry](./spoon_ai/rag/vectorstores/registry.md)
85+
- [spoon_ai.rag](./spoon_ai/rag.md)
9986
- [spoon_ai.runnables](./spoon_ai/runnables/)
10087
- [spoon_ai.runnables.base](./spoon_ai/runnables/base.md)
10188
- [spoon_ai.runnables.events](./spoon_ai/runnables/events.md)

docs/api-reference/spoon_ai/agents.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ title: spoon_ai.agents
2323
* [discover\_skills](#spoon_ai.agents.spoon_react_skill.SpoonReactSkill.discover_skills)
2424
* [spoon\_ai.agents.base](#spoon_ai.agents.base)
2525
* [ThreadSafeOutputQueue](#spoon_ai.agents.base.ThreadSafeOutputQueue)
26+
* [put\_nowait](#spoon_ai.agents.base.ThreadSafeOutputQueue.put_nowait)
2627
* [get](#spoon_ai.agents.base.ThreadSafeOutputQueue.get)
2728
* [BaseAgent](#spoon_ai.agents.base.BaseAgent)
2829
* [add\_message](#spoon_ai.agents.base.BaseAgent.add_message)
@@ -247,19 +248,23 @@ Initializes both SpoonReactAI and skill system components.
247248
#### `run`
248249

249250
```python
250-
async def run(request: Optional[str] = None) -> str
251+
async def run(request: Optional[str] = None,
252+
timeout: Optional[float] = None) -> str
251253
```
252254

253-
Execute agent with skill auto-activation.
255+
Execute agent with per-turn auto skill activation.
254256

255257
Flow:
256-
1. Auto-detect and activate relevant skills (if enabled)
257-
2. Inject skill context into system prompt
258-
3. Execute parent SpoonReactAI.run()
258+
1. Auto-detect and activate relevant skills (ephemeral for this run)
259+
2. Sync skill tools into available_tools
260+
3. Refresh base prompts with current tools
261+
4. Execute parent SpoonReactAI.run()
262+
5. Auto-deactivate skills activated in this turn
259263

260264
**Arguments**:
261265

262266
- `request` - User request/message
267+
- `timeout` - Optional timeout in seconds
263268

264269

265270
**Returns**:
@@ -320,12 +325,22 @@ class ThreadSafeOutputQueue()
320325

321326
Thread-safe output queue with fair access and timeout protection
322327

328+
<a id="spoon_ai.agents.base.ThreadSafeOutputQueue.put_nowait"></a>
329+
330+
#### `put_nowait`
331+
332+
```python
333+
def put_nowait(item: Any) -> None
334+
```
335+
336+
Non-blocking put - delegates to the underlying asyncio.Queue.
337+
323338
<a id="spoon_ai.agents.base.ThreadSafeOutputQueue.get"></a>
324339

325340
#### `get`
326341

327342
```python
328-
async def get(timeout: Optional[float] = 30.0) -> Any
343+
async def get(timeout: float | None = 30.0) -> Any
329344
```
330345

331346
Get item with timeout and fair access
@@ -347,10 +362,10 @@ Thread-safe base class for all agents with proper concurrency handling.
347362
```python
348363
async def add_message(role: Literal["user", "assistant", "tool"],
349364
content: MessageContent,
350-
tool_call_id: Optional[str] = None,
351-
tool_calls: Optional[List[ToolCall]] = None,
352-
tool_name: Optional[str] = None,
353-
timeout: Optional[float] = None) -> None
365+
tool_call_id: str | None = None,
366+
tool_calls: list[ToolCall] | None = None,
367+
tool_name: str | None = None,
368+
timeout: float | None = None) -> None
354369
```
355370

356371
Thread-safe message addition with timeout protection.
@@ -375,12 +390,12 @@ Supports both text-only and multimodal content:
375390
```python
376391
async def add_message_with_image(role: Literal["user", "assistant"],
377392
text: str,
378-
image_url: Optional[str] = None,
379-
image_data: Optional[str] = None,
393+
image_url: str | None = None,
394+
image_data: str | None = None,
380395
image_media_type: str = "image/png",
381396
detail: Literal["auto", "low",
382397
"high"] = "auto",
383-
timeout: Optional[float] = None) -> None
398+
timeout: float | None = None) -> None
384399
```
385400

386401
Convenience method to add a message with an image.
@@ -423,8 +438,8 @@ Supports both URL-based and base64-encoded images.
423438
async def add_message_with_pdf(role: Literal["user", "assistant"],
424439
text: str,
425440
pdf_data: str,
426-
filename: Optional[str] = None,
427-
timeout: Optional[float] = None) -> None
441+
filename: str | None = None,
442+
timeout: float | None = None) -> None
428443
```
429444

430445
Convenience method to add a message with a PDF document.
@@ -457,8 +472,8 @@ async def add_message_with_document(role: Literal["user", "assistant"],
457472
text: str,
458473
document_data: str,
459474
media_type: str = "application/pdf",
460-
filename: Optional[str] = None,
461-
timeout: Optional[float] = None) -> None
475+
filename: str | None = None,
476+
timeout: float | None = None) -> None
462477
```
463478

464479
Convenience method to add a message with a document.
@@ -494,7 +509,7 @@ Supports various document types including PDF, text, etc.
494509
async def add_message_with_pdf_file(role: Literal["user", "assistant"],
495510
text: str,
496511
file_path: str,
497-
timeout: Optional[float] = None) -> None
512+
timeout: float | None = None) -> None
498513
```
499514

500515
Convenience method to add a message with a PDF file from disk.
@@ -526,7 +541,7 @@ async def add_message_with_image_file(role: Literal["user", "assistant"],
526541
text: str,
527542
file_path: str,
528543
detail: str = "auto",
529-
timeout: Optional[float] = None) -> None
544+
timeout: float | None = None) -> None
530545
```
531546

532547
Convenience method to add a message with an image file from disk.
@@ -558,7 +573,7 @@ Automatically handles base64 encoding and MIME type detection.
558573
async def add_message_with_file(role: Literal["user", "assistant"],
559574
text: str,
560575
file_path: str,
561-
timeout: Optional[float] = None) -> None
576+
timeout: float | None = None) -> None
562577
```
563578

564579
Convenience method to add a message with any supported file from disk.
@@ -586,8 +601,7 @@ Supports: PDF, images (png, jpg, gif, webp), text files.
586601

587602
```python
588603
@asynccontextmanager
589-
async def state_context(new_state: AgentState,
590-
timeout: Optional[float] = None)
604+
async def state_context(new_state: AgentState, timeout: float | None = None)
591605
```
592606

593607
Thread-safe state context manager with deadlock prevention.
@@ -600,8 +614,7 @@ false timeouts during network calls.
600614
#### `run`
601615

602616
```python
603-
async def run(request: Optional[str] = None,
604-
timeout: Optional[float] = None) -> str
617+
async def run(request: str | None = None, timeout: float | None = None) -> str
605618
```
606619

607620
Thread-safe run method with proper concurrency control, callback support, and Plan-Act-Reflect phases.
@@ -611,7 +624,7 @@ Thread-safe run method with proper concurrency control, callback support, and Pl
611624
#### `step`
612625

613626
```python
614-
async def step(run_id: Optional[uuid.UUID] = None) -> str
627+
async def step(run_id: uuid.UUID | None = None) -> str
615628
```
616629

617630
Override this method in subclasses - now with step-level locking and callback support.
@@ -704,7 +717,7 @@ Thread-safe chat history saving
704717
#### `stream`
705718

706719
```python
707-
async def stream(timeout: Optional[float] = None)
720+
async def stream(timeout: float | None = None)
708721
```
709722

710723
Thread-safe streaming with proper cleanup and timeout
@@ -716,9 +729,9 @@ Thread-safe streaming with proper cleanup and timeout
716729
```python
717730
async def process_mcp_message(content: Any,
718731
sender: str,
719-
message: Dict[str, Any],
732+
message: dict[str, Any],
720733
agent_id: str,
721-
timeout: Optional[float] = None)
734+
timeout: float | None = None)
722735
```
723736

724737
Thread-safe MCP message processing with timeout protection
@@ -773,7 +786,7 @@ Set value in agent state (for middleware access).
773786
#### `update_agent_state`
774787

775788
```python
776-
def update_agent_state(updates: Dict[str, Any]) -> None
789+
def update_agent_state(updates: dict[str, Any]) -> None
777790
```
778791

779792
Bulk update agent state (for middleware access).
@@ -787,7 +800,7 @@ Bulk update agent state (for middleware access).
787800
#### `get_diagnostics`
788801

789802
```python
790-
def get_diagnostics() -> Dict[str, Any]
803+
def get_diagnostics() -> dict[str, Any]
791804
```
792805

793806
Get diagnostic information about the agent's state
@@ -1542,7 +1555,8 @@ Initialize async components and subscribe to topics
15421555
#### `run`
15431556

15441557
```python
1545-
async def run(request: Optional[str] = None) -> str
1558+
async def run(request: Optional[str] = None,
1559+
timeout: Optional[float] = None) -> str
15461560
```
15471561

15481562
Ensure prompts reflect current tools before running.

0 commit comments

Comments
 (0)